//
//  MyOrdersTableViewCell.m
//  XDCommonApp
//
//  Created by xindao on 14-9-18.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "MyOrdersTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation MyOrdersTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self makeViews];
    }
    return self;
}

- (void)makeViews{
    _headerIV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 70, 70)];
    _headerIV.layer.cornerRadius = 35;
    _headerIV.layer.masksToBounds = YES;
    [self.contentView addSubview:_headerIV];

    _titleLB = [UILabel initLabelText:@"满月照A套餐20张" andRect:CGRectMake(VIEW_POINT_MAX_X(_headerIV)+10, 10, 160, 20) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:16] andTextColor:[UIColor blackColor] andTextAlignment:NSTextAlignmentLeft];
    [self.contentView addSubview:_titleLB];
    //    _titleLB.backgroundColor = [UIColor orangeColor];

    _nameLB = [UILabel initLabelText:@"摄影师张三" andRect:CGRectMake(VIEW_POINT_MAX_X(_headerIV)+10, height_y(_titleLB), 150, 20) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:14] andTextColor:RGBA(111, 96, 83, 1) andTextAlignment:NSTextAlignmentLeft];
    [self.contentView addSubview:_nameLB];



    _timeLB = [UILabel initLabelText:@"拍摄时间：2014-10-01" andRect:CGRectMake(VIEW_POINT_MAX_X(_headerIV)+10, height_y(_nameLB)+10, 150, 20) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:13] andTextColor:RGBA(197, 197, 197, 1) andTextAlignment:NSTextAlignmentLeft];
    [self.contentView addSubview:_timeLB];



    _priceLB = [UILabel initLabelText:@"￥800" andRect:CGRectMake(UI_SCREEN_WIDTH-75-10, 10, 75, 20) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:16] andTextColor:RGBA(255, 94, 80, 1) andTextAlignment:NSTextAlignmentLeft];
    _priceLB.font = [UIFont systemFontOfSize:14.0f];
    [self.contentView addSubview:_priceLB];

    _statusBtn = [UIButton initButton:CGRectMake(UI_SCREEN_WIDTH-75, 50, 65, 27) btnNorImage:nil btnHighlightImage:nil btnTitle:nil titleColor:[UIColor whiteColor] titleFont:[UIFont systemFontOfSize:14]];
    [_statusBtn addTarget:self action:@selector(ChangeDelegateStatus:) forControlEvents:UIControlEventTouchUpInside];
    _statusBtn.layer.masksToBounds = YES;
    _statusBtn.layer.cornerRadius = 6.0f;
    _statusBtn.backgroundColor = [UIColor blueColor];
    _statusBtn.userInteractionEnabled = NO;

    [self.contentView addSubview:_statusBtn];

    for (int i = 0; i < 2; i++) {
        UIView * line = [[UIView alloc] initWithFrame:CGRectMake(0, 89.5*i, UI_SCREEN_WIDTH, .5f)];
        line.backgroundColor = UIColorFromRGB(0xd4ccc5);
        [self.contentView addSubview:line];
    }
}

- (void)ChangeDelegateStatus:(UIButton *)sender{
    [_delegate changeStatus:sender];
}

- (void)initViewsWithDict:(NSDictionary *)dict{
    [self.headerIV sd_setImageWithURL:[NSURL URLWithString:@"http://img0.bdstatic.com/img/image/shouye/mxfbb-9625937261.jpg"] placeholderImage:nil];
}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
